/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.upn.sigemfi.vfi.be;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Alex
 */
@Entity
@Table(name = "VFI_DETALLE_CAJA", catalog = "SIGEMFI", schema = "dbo")
@NamedQueries({@NamedQuery(name = "DetalleCaja.findAll", query = "SELECT d FROM DetalleCaja d"), @NamedQuery(name = "DetalleCaja.findByIdDetallecaja", query = "SELECT d FROM DetalleCaja d WHERE d.idDetallecaja = :idDetallecaja"), @NamedQuery(name = "DetalleCaja.findByFecha", query = "SELECT d FROM DetalleCaja d WHERE d.fecha = :fecha")})
public class DetalleCaja implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ID_DETALLECAJA", nullable = false)
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long idDetallecaja;
    @Column(name = "FECHA")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fecha;
    @JoinColumn(name = "FID_VIF_CAJA", referencedColumnName = "ID_CAJA")
    @ManyToOne
    private Caja fidVfiCaja;
    @JoinColumn(name = "FID_VFI_DETALLE_TRANSACCION", referencedColumnName = "ID_DETALLE_TRANSACCION")
    @ManyToOne
    private DetalleTransaccion fidVfiDetalleTransaccion;

    public DetalleCaja() {
    }

    public DetalleCaja(Long idDetallecaja) {
        this.idDetallecaja = idDetallecaja;
    }

    public Long getIdDetallecaja() {
        return idDetallecaja;
    }

    public void setIdDetallecaja(Long idDetallecaja) {
        this.idDetallecaja = idDetallecaja;
    }

    public Date getFecha() {
        return fecha;
    }

    public void setFecha(Date fecha) {
        this.fecha = fecha;
    }

    public Caja getFidVfiCaja() {
        return fidVfiCaja;
    }

    public void setFidVfiCaja(Caja fidVfiCaja) {
        this.fidVfiCaja = fidVfiCaja;
    }

    public DetalleTransaccion getFidVfiDetalleTransaccion() {
        return fidVfiDetalleTransaccion;
    }

    public void setFidVfiDetalleTransaccion(DetalleTransaccion fidVfiDetalleTransaccion) {
        this.fidVfiDetalleTransaccion = fidVfiDetalleTransaccion;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idDetallecaja != null ? idDetallecaja.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof DetalleCaja)) {
            return false;
        }
        DetalleCaja other = (DetalleCaja) object;
        if ((this.idDetallecaja == null && other.idDetallecaja != null) || (this.idDetallecaja != null && !this.idDetallecaja.equals(other.idDetallecaja))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "edu.upn.sigemfi.vfi.be.DetalleCaja[idDetallecaja=" + idDetallecaja + "]";
    }
}
